package com.example.dmdomain;

import com.example.dmdomain.entity.Policy;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PolicyRepository extends JpaRepository<Policy,String>, JpaSpecificationExecutor<Policy> {

    List<Policy> findPoliciesByUseType(@Param("userType") Integer useType);

    Policy findPolicyByCompanyAndDistrictAndUseType(@Param("company") String company,
                                                    @Param("district") String district,
                                                    @Param("useType") Integer useType);

    List<Policy> findPoliciesByDistrict(@Param("district") String district);


}
